#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setAttribute( Qt::WA_MacBrushedMetal );
    ui->appList->setStyleSheet( "QListWidget { background-color: #E7EDF6; }" ); /* Mac style? */

    /*QFrame *a = new QFrame();
    QLabel *la = new QLabel( "<strong>Nice app</strong><br />A lot of info about them", a );
    a->setStyleSheet("QFrame { width: 100%; padding: 10px; border-bottom: 1px solid #BBBBBB; }");
    QListWidgetItem *test = new QListWidgetItem(ui->appList);
    test->setSizeHint(QSize(200,100));
    ui->appList->setItemWidget( test, a );*/

    for( int i=0; i<10; i++ )
    {
    QLabel *label = new QLabel( "WPtogo" );
    label->setStyleSheet("QLabel { color: #505D6D; font-size: 22px; border: none; }");

    QPushButton *button = new QPushButton( "X" );
    button->setSizeIncrement( 20, 20 );

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget( label );
    layout->addWidget( button );

    QWidget *widget = new QWidget;
    widget->setLayout(layout);
    widget->setStyleSheet("padding: 10px; border-bottom: 1px solid #BBBBBB;");

    QListWidgetItem *test = new QListWidgetItem(ui->appList);
    test->setSizeHint(QSize(200,100));
    ui->appList->setItemWidget( test, widget );
}
}

void MainWindow::Test(QPoint*p)
{
    QMessageBox::information(this,"a","b");
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
